/*
 * 销售渠道下拉列表
 * 参数   交易码：trancode=SaleChannel
 * 
 */

package org.ccams.tran;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.ccams.domain.TSalesChannel;
/*
 *  销售渠道下拉列表
 */
public class TranSaleChannel extends AbstractJsonTran {

	@SuppressWarnings("unchecked")	
	public void buildJSONObject(Map model, JSONObject json,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HashMap<String, Object> jsonMap = new HashMap<String, Object>();
		ArrayList<TSalesChannel> al = new ArrayList<TSalesChannel>();
		List<TSalesChannel> list = getCcamsService().getTsaleschannelDao().getAll();
		for(TSalesChannel t : list){
			TSalesChannel tm = new TSalesChannel();
			tm.setSalesChannelCode(t.getSalesChannelCode());
			tm.setMeaning(t.getMeaning());
			al.add(tm);
		}
		JSONArray JsonArray = JSONArray.fromObject(al); //得到JSON数组 
        jsonMap.put("root", JsonArray);
        json.putAll(jsonMap);
	}
}
